MUX_WORD block

Short summary

Name

MUX_WORD

→POU type

→function

Category

IEC-block, Select, block with internal error diagnostic

Conform to →IEC-standard

(plus) more possible than defined in IEC-standard
(IEC demands ANY_ELEMENTARY for the inputs and the return value.)

but also:

(error) currently restricted
(IEC demands data type ANY_ELEMENTARY for the inputs, hence the following data types are demanded as well: LTIMEWSTRINGWCHARLDATE_AND_TIMELTIME_OF_DAY and LDATE. Currently, these data types are not supported for the block.) 

Graphical interface

Available since

  • version 1.22.0 (for Neuron Power Engineer) – initial variant

  • version 1.109.0 (for Neuron Power Engineer) – enhancement: STRING and CHAR for IN0, IN1 ... IN15 and for the return value

  • version 3.0.1 (for library Standard) – enhancement: user-defined data types and references for IN0IN1 ... IN15 and for the return value 

Functionality

Depending on the input K, the block selects one of the values connected at the other inputs.

If value 0 is connected at input K, the block returns the value connected at input IN0. Value 1 for input K has the block return the value connected at input IN1, value 2 has the value of input IN2 returned etc.

Inputs, return value

 

Identifier

→Data type

Description

Inputs:

K

WORD

selector

IN0

REALLREALUSINTUINTUDINTULINTSINTINTDINTLINTTIMEBOOLBYTEWORDDWORDLWORDSTRINGCHARDATE_AND_TIMEDATETIME_OF_DAY, a →user-defined data type, a →function block or a →reference
Restriction: In case of →array data types, only one-dimensional arrays are allowed.

1st value

IN1

REALLREALUSINTUINTUDINTULINTSINTINTDINTLINTTIMEBOOLBYTEWORDDWORDLWORDSTRINGCHARDATE_AND_TIMEDATETIME_OF_DAY, a →user-defined data type, a →function block or a →reference
Restriction: In case of →array data types, only one-dimensional arrays are allowed.

2nd value

... (extensible until)

 

IN15

REALLREALUSINTUINTUDINTULINTSINTINTDINTLINTTIMEBOOLBYTEWORDDWORDLWORDSTRINGCHARDATE_AND_TIMEDATETIME_OF_DAY, a →user-defined data type, a →function block or a →reference
Restriction: In case of →array data types, only one-dimensional arrays are allowed.

16th value

Return value:

REALLREALUSINTUINTUDINTULINTSINTINTDINTLINTTIMEBOOLBYTEWORDDWORDLWORDSTRINGCHARDATE_AND_TIMEDATETIME_OF_DAY, a →user-defined data type, a →function block or a →reference
Restriction: In case of →array data types, only one-dimensional arrays are allowed.

 

Input EN and output ENO are available when →calling the block. See "Execution control: EN, ENO" for information on input EN and output ENO.

See:

Internal error diagnostic for block 

The block checks the value connected to input K before it is executed.
If the value for K is > the highest connected input, the output ENO of the block is set to value FALSE (or an equivalent) and the block returns the value 0.

Example for usage within ST-editor

PROGRAM Test
    VAR
        result1, result2, result3, result4 : WORD;
        stateENO1 : BOOL;
    END_VAR
    result1 := MUX_WORD(K := 16#0002, IN0 := 16#0001, IN1 := 16#0002, IN2 := 16#0003, IN3 := 16#0004, IN4 := 16#0005);       (* The variable 'result1' evaluates to '16#0003'. *)
    result2 := MUX_WORD(K := 16#0004, IN0 := 16#0001, IN1 := 16#0002, IN2 := 16#0003, IN3 := 16#0004, IN4 := 16#0005);       (* The variable 'result2' evaluates to '16#0005'.  *)
    result3 := MUX_WORD(K := 16#0000, IN0 := 16#0001, IN1 := 16#0002, IN2 := 16#0003, IN3 := 16#0004, IN4 := 16#0005);       (* The variable 'result3' evaluates to '16#0001'.  *)
    result4 := MUX_WORD(K := 16#0007, IN0 := 16#0001, IN1 := 16#0002, IN2 := 16#0003, IN3 := 16#0004, IN4 := 16#0005, ENO => stateENO1);      (* The variable 'result4' evaluates to '0', 'stateENO1' to 'FALSE'. *)
END_PROGRAM

When creating your application within the ST-editor, enter a call of a block by typing the text as requested by the syntax or use Content Assist.